package vtt.android.dapanhc;

import vtt.android.library.utils.VttLog;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;

import com.google.analytics.tracking.android.EasyTracker;

public class BaseActivity extends ActionBarActivity {
	
	protected static VttLog log = null;
	protected ActionBar actionBar;
	protected Context mContext;
	
	ImageView btnUp;
	TextView txtTitle;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mContext = this;
		
		log = new VttLog(getClass().getSimpleName(), BaseApplication.isDebuggable);
		log.d("VTT>>> onCreate");
		EasyTracker.getInstance().setContext(this);
		
		initActionBar();
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
	}

	protected void initActionBar() {
		actionBar = getSupportActionBar();
		if (actionBar != null) {
//			actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.background_repeat_dark));
		}
	}
	
	public void setCustomTitle(String title){
		txtTitle.setText(title);
	}
	
	@Override
	protected void onStart() {
		super.onStart();
		EasyTracker.getInstance().activityStart(this);
	}

	@Override
	protected void onStop() {
		super.onStop();
		EasyTracker.getInstance().activityStop(this);
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
//		switch (item.getItemId()) {
//		case android.R.id.home:
//			//finish();
//			break;
//
//		default:
//			break;
//		}
		return super.onOptionsItemSelected(item);
	}

}
